<template>
    <div class="export-data">
        <div class="export-data-title" style="display: flex;justify-content: space-between;align-items: center">
            <span>每日日报</span>
            <el-button type="primary" size="small" @click="getPdf()" style="margin-right:10px">导出PDF</el-button>
        </div>
        <div class="export-data-contents" id="pdfDom"  v-loading="loading">
            <!--<lar-chart-pie></lar-chart-pie>-->
            <div class="content">
                <div class="title">
                    <div class="title-name">大马鹿日报</div>
                    <!--<div class="title-date">2019-01-21 19:00</div>-->
                </div>
                <div>
                    <waybill-statistics :waybillData="dataList.count"></waybill-statistics>
                </div>
                <div ></div>
                <div >
                    <order-statistics  :orderData="dataList.beijing"></order-statistics>
                </div>
                <div ></div>
                <div  style="page-break-after: always">
                    <today-sending-statistics :todayData="dataList.today"></today-sending-statistics>
                </div>
                <div >
                    <order-num-statistics :todayData="dataList.today" :driverShangNum="driverShangNum"></order-num-statistics>
                </div>

            </div>
        </div>
    </div>
</template>

<script>
    import waybillStatistics from './dayReport/waybillStatistics';
    import todaySendingStatistics from './dayReport/todaySendingStatistics';
    import orderNumStatistics from './dayReport/orderNumStatistics';
    import orderStatistics from './dayReport/orderStatistics';
    export default {
        name: "dayReportForm",
        data() {
            return {
                dataList: {},
                driverData: [],
                driverShangNum: null,
                loading: false,
                htmlTitle: '每日日报'
            }
        },
        mounted() {
            this.getDataList();
            this.getStatisticsData()
        },
        methods: {
            getStatisticsData() {  // 获取统计数据
                this.$http.get('user/driver_count')
                    .then((response) => {
                        response.data.data.forEach(item=>{
                            if (item.name == '上班司机') {
                                this.driverShangNum = item.count;
                            }
                        })
                    })
                    .catch((error) => {
                        if (error.response.data.msg) {
                            this.$message.error(error.response.data.msg);
                        } else {
                            this.$message.error('请求错误：' + error.response.status);
                        }
                    });
            },
            getDataList() {
                this.loading = true;
                this.$http.get('express/everydayReport?type=all')
                    .then((response) => {
                        this.dataList = response.data.data;
                        this.loading = false;
                    })
                    .catch((error) => {
                        this.loading = false;
                        if (error.response.data.msg) {
                            this.$message.error(error.response.data.msg);
                        } else {
                            this.$message.error('请求错误：' + error.response.status);
                        }
                    });
            }
        },
        components: {
            orderStatistics,
            todaySendingStatistics,
            orderNumStatistics,
            waybillStatistics
        }
    }
</script>

<style scoped lang="less">
    .export-data{
        zoom: 1.1;
        padding: 10px 0 10px 10px;
        .padt10{
            padding-top: 10px;
        }
        .export-data-title{
            background-color: #fff;
            height: 42px;
            line-height: 42px;
            padding-left: 16px;
            font-size: 16px;
            border-bottom: 2px solid #eee;
        }
        .export-data-contents{
            /*height: 2000px;*/
            background-color: #fff;
            color: #000;
            padding: 0 0 20px 0px;
            .content{
                width: 800px;
                margin: 0 auto;
                padding: 52px 0;
                .title{
                    text-align: center;
                    .title-name{
                        font-size:30px;
                    }
                    .title-date{
                        font-size:16px;
                        color:rgba(0,0,0,0.38);
                    }
                }
            }

        }
    }
</style>
